package com.example.controller;

import com.example.entity.paperlessMaintance.PaperlessMaintanceApply;
import com.example.ext.entity.ExtElevator;
import com.example.service.PaperlessMaintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("api/paperlessMaint/")
public class PaperlessMaintController {

    @Autowired
    PaperlessMaintService paperlessMaintService;

    @RequestMapping(value = "add", method = RequestMethod.POST)
    public Map<String,Object> add(@RequestBody PaperlessMaintanceApply paperlessMaintanceApply){
        Map<String,Object> result = paperlessMaintService.add(paperlessMaintanceApply);
        return result;
    }

    @RequestMapping(value = "query", method = RequestMethod.POST)
    public Map<String,Object> query(@RequestBody PaperlessMaintanceApply paperlessMaintanceApply){
        Map<String,Object> result = paperlessMaintService.query(paperlessMaintanceApply);
        return result;
    }

    /**
     * 无纸化审核
     * @param paperlessMaintanceApply
     * @return
     */
    @RequestMapping(value = "update", method = RequestMethod.POST)
    public Map<String,Object> update(@RequestBody PaperlessMaintanceApply paperlessMaintanceApply){
        return paperlessMaintService.update(paperlessMaintanceApply);
    }


    /**
     * 无纸化审核 监管单位
     * @param paperlessMaintanceApply
     * @return
     */
    @RequestMapping(value = "updateCheck", method = RequestMethod.POST)
    public Map<String,Object> updateCheck(@RequestBody PaperlessMaintanceApply paperlessMaintanceApply){
        return paperlessMaintService.updateCheck(paperlessMaintanceApply);
    }



    @RequestMapping(value = "delete", method = RequestMethod.POST)
    public Map<String,Object> delete(@RequestBody Map map){
        return paperlessMaintService.delete(map);
    }

    /**
     * 导出承诺书文件
     * @param paperlessMaintanceApply
     * @return
     */
    @RequestMapping(value = "export", method = RequestMethod.POST)
    public Map<String,Object> export(@RequestBody PaperlessMaintanceApply paperlessMaintanceApply){
        return paperlessMaintService.exportLetterOfCommitmentDoc(paperlessMaintanceApply);
    }


    /**
     * 无纸化维保获取可选的申请对象
     * @param extElevator
     * @return
     */
    @RequestMapping(value = "getOptionalJgParty", method = RequestMethod.POST)
    public Map<String,Object> getOptionalJgParty(@RequestBody ExtElevator extElevator){
        return paperlessMaintService.getOptionalJgParty(extElevator);
    }

    /**
     * 获取维保单位电梯所在的区局
     */
    @RequestMapping(value = "paperlessGetApplicantList", method = RequestMethod.POST)
    public Map<String,Object> paperlessGetApplicantList(@RequestBody Map map){
        return paperlessMaintService.paperlessGetApplicantList(map);
    }

    /**
     * 开始核查申报条件
     */
    @RequestMapping(value = "paperlessStartCheck", method = RequestMethod.POST)
    public Map<String,Object> paperlessStartCheck(@RequestBody Map map){
        return paperlessMaintService.paperlessStartCheck(map);
    }
}
